<template>
	<view class="coll_type_box">
		<u-field v-model="form.name" label="支付宝姓名" placeholder="请输入支付宝姓名">
		</u-field>
		<u-field v-model="form.alipay" label="支付宝账户" placeholder="请输入支付宝账户">
		</u-field>
		<u-button style="margin-top: 80rpx;" @click="submit" type="primary">保存信息</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					name: '',
					alipay: ''
				}
			};
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				// paymentTerm,setPaymentTerm
				this.$u.api.paymentTerm().then(res => {
					this.form = res
				})
			},
			submit() {
				// if (!this.form.wechat) {
				// 	uni.showToast({
				// 		title: '请输入微信账号'
				// 	})
				// 	return
				// }
				// if (!this.form.alipay) {
				// 	uni.showToast({
				// 		title: '请输入支付宝账号'
				// 	})
				// 	return
				// }
				this.$u.api.setPaymentTerm(this.form).then(res => {
					uni.showToast({
						title: '设置成功',
						icon: 'none'
					})
					uni.navigateTo({
						url: '/pages/my/balance/balance'
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.coll_type_box {
		padding: 20rpx;
	}
</style>
